package edu.ntu.im.p2ptrade.action;

import javax.servlet.http.HttpServletRequest;

import edu.ntu.im.p2ptrade.TransactionManager;

public class ConsumeRequest extends AjaxAction {

	@Override
	public AjaxResponse execute(HttpServletRequest request) {
		String transactionId = request.getParameter("transactionId");
		String type = request.getParameter("type");
		if (type.equals("aborted")){
		TransactionManager.getInstance().getAbortedReq().remove(transactionId);
		}else if (type.equals("denied")){
			TransactionManager.getInstance().getDeniedReq().remove(transactionId);
		}else if (type.equals("success")){
			TransactionManager.getInstance().getSuccessReq().remove(transactionId);
		}
		return success();
	}

}
